Skip to content

feat(exchange): add grouping parameter to bulk_orders and order_wires…#224

Closed
vivekascoder wants to merge 8 commits into
hyperliquid-dex:masterfrom
vivekascoder:master
Closed

feat(exchange): add grouping parameter to bulk_orders and order_wires…#224
vivekascoder wants to merge 8 commits into
hyperliquid-dex:masterfrom
vivekascoder:master

Conversation

@vivekascoder

Copy link
Copy Markdown

add support for grouping while sending bulk orders

@traderben

Copy link
Copy Markdown
Contributor

The grouping API is pretty confusing so if you are willing to update the basic_tpsl example to demonstrate how to use the different groupings that would be great. At a minimum, you would need to get Lint passing before this can be merged

@vivekascoder

Copy link
Copy Markdown
Author

@traderben I'm thinking of adding another example for basic group order that creates a market order with tp and sl associated with it? How does that sound?

@vivekascoder

vivekascoder commented Oct 31, 2025

Copy link
Copy Markdown
Author

nvm, I'll just add that thing in basic_tpsl

@traderben

Copy link
Copy Markdown
Contributor

nvm, I'll just add that thing in basic_tpsl

Either option sounds good to me. Thanks!

…plement bulk order placement with take profit and stop loss
@vivekascoder

Copy link
Copy Markdown
Author

Added the example for market order with tp and sl with group order

Comment thread examples/basic_tpsl.py Outdated
Comment thread examples/basic_tpsl.py Outdated
Comment thread examples/basic_tpsl.py Outdated
Comment thread examples/basic_tpsl.py
"is_buy": position_is_long,
"sz": quantity,
"limit_px": px,
# "order_type": {"limit": {"tif": "Gtc"}},

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't leave commented code, but also I think leaving as GTC is a better example

Comment thread examples/basic_tpsl.py Outdated
Comment thread examples/basic_tpsl.py Outdated

@vivekascoder vivekascoder left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed the proposed changes

@vivekascoder

Copy link
Copy Markdown
Author

still getting lint error for missing return type

hyperliquid/utils/signing.py:499:1: error: Function is missing a type
annotation for one or more arguments  [no-untyped-def]
    def order_wires_to_order_action(order_wires, builder=None, grouping: G...
    ^
Found 2 errors in 1 file (checked 54 source files

should I add Dict[str, Any] ?

@traderben

Copy link
Copy Markdown
Contributor

still getting lint error for missing return type

hyperliquid/utils/signing.py:499:1: error: Function is missing a type
annotation for one or more arguments  [no-untyped-def]
    def order_wires_to_order_action(order_wires, builder=None, grouping: G...
    ^
Found 2 errors in 1 file (checked 54 source files

should I add Dict[str, Any] ?

I think it's better to have it return Any than Dict[str, Any] Another option would be to instead not add the type to grouping and leave the function untyped

@vivekascoder

Copy link
Copy Markdown
Author

still getting lint error for missing return type

hyperliquid/utils/signing.py:499:1: error: Function is missing a type
annotation for one or more arguments  [no-untyped-def]
    def order_wires_to_order_action(order_wires, builder=None, grouping: G...
    ^
Found 2 errors in 1 file (checked 54 source files

should I add Dict[str, Any] ?

I think it's better to have it return Any than Dict[str, Any] Another option would be to instead not add the type to grouping and leave the function untyped

Any for order_wires_to_order_action sounds good.

@vivekascoder

Copy link
Copy Markdown
Author

I've done the following for order_wires_to_order_action

def order_wires_to_order_action(order_wires: list[OrderWire], builder: Any = None, grouping: Grouping = "na") -> Any:
    action = {
        "type": "order",
        "orders": order_wires,
        "grouping": grouping,
    }
    if builder:
        action["builder"] = builder
    return action

I was thinking I could improve it by adding types to all params, like Optional[BuilderInfo]
, but that causes the issue as action doesn't have a type, lmk if action has a type defined, or if you want me to define it and add explicit types whereever possible.

For now this should work? No lint issue now.

@vivekascoder

Copy link
Copy Markdown
Author

Also, would love to pick up any other issues I can help with, just lmk.

@vivekascoder

Copy link
Copy Markdown
Author

Hello ser, anything here?

Comment thread examples/basic_tpsl.py Outdated
Comment thread examples/basic_tpsl.py Outdated
@vivekascoder

Copy link
Copy Markdown
Author

@traderben fixed the proposed changes

@vivekascoder

Copy link
Copy Markdown
Author

@traderben is there any other issue I can pick to work on?

@traderben

Copy link
Copy Markdown
Contributor

@traderben is there any other issue I can pick to work on?

No thanks

@traderben

Copy link
Copy Markdown
Contributor

I cleaned this up and included it in #230

@traderben traderben closed this Nov 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants